<extend name="Base/common" />

<block name="style">
	<link rel="stylesheet" href="__STATIC__/Swiper/swiper3.07.min.css" />
	<link rel="stylesheet" href="__CSS__/Index/index.css" />
	
	<style>
		.swiper-img{width: 100%;height:auto;}
		.btn-div{margin: 1rem 0 1.4rem 0;}
	</style>
</block>

<block name="body">
	
	<!--轮播开始-->
	<div class="swiper-container">
		<div class="swiper-wrapper">
			<foreach name="lact" item="v">
				<div class="swiper-slide" data-url="{$v.acturl}" onclick="show_lb_act(this)">
					<img src="{$v.imgurl}" class="swiper-img">
				</div>
			</foreach>
		</div>
		<div class="swiper-pagination"></div>
	</div>

	<!--轮播结束-->
	<div class="article text-align-center">
		<input type="hidden" value="{$p}" id="page" />
		<notempty name="act">
			<foreach name="act" item="v">
				<div class="ypre-article col-xs-12 wid31 mlr1_" id="ypre_article" style="background-image: url({$v.theme});" data-id="{$v.id}" onclick="show(this)">
					<div style="width:100%;height: 5rem;"></div>
					<div class="ypre-article-info">
						<p class="yinfo-title">{$v.title}</p>
						<p><i class="fa fa-map-marker fc-graywhite ml2"></i>{$v.address}</p>
						<p><i class="fa fa-clock-o fc-graywhite"></i>{$v.atime|date='m月d日 H:i',###}--{$v.aetime|date='H:i',###}</p>
					</div>
				</div>
			</foreach>
			<else/>
			<div class="text-align-center">暂无数据！！！</div>
		</notempty>
		<script>if(device == 'phone'){$('.ypre-article').removeClass('wid31 mlr1_')}</script>
	</div>
	<if condition="$situation eq first">
			<div class="text-align-center btn-div">
				<button class="btn btn-primary" type="button" onclick="nextpage()">下一页</button>
			</div>
		</if>
		<if condition="$situation eq middle">
			<div class="text-align-center btn-div">
				<button class="btn btn-primary" type="button" onclick="backpage()">上一页</button>
				<button class="btn btn-primary" type="button" onclick="nextpage()">下一页</button>
			</div>
		</if>
		<if condition="$situation eq last">
			<div class="text-align-center btn-div">
				<button class="btn btn-primary" type="button" onclick="backpage()">上一页</button>
			</div>
		</if>
</block>
<block name="script">
	<script src="__STATIC__/Swiper/swiper3.07.min.js"></script>
	<script>
//		window.onbeforeunload = onbeforeunload_handler;
//		function onbeforeunload_handler(){
//			return 'test';
//		}
	
		//轮播JS
			var mySwiper = new Swiper('.swiper-container',{
			     pagination: '.swiper-pagination',
			     loop:true,
			     grabCursor: true,
			     paginationClickable: true,
			     autoplay: 3000,
			     autoplayDisableOnInteraction:false,
			})
		//
		function show(o){
			var id = $(o).attr('data-id');
			location.href="__ROOT__/Activity/act_detail/id/"+id+'/shareaid/'+id+'/isshare/'+1;	
		}
		function show_lb_act(o){
			var acturl = $(o).attr('data-url');
			location.href = acturl;
		}
		function nextpage(){
			var p = parseInt($('#page').val())+1;
			location.href='__ROOT__/Index/index/p/'+p;
		}
		function backpage(){
			var p = parseInt($('#page').val())-1;
			location.href='__ROOT__/Index/index/p/'+p;
		}
	</script>
</block>